<%--
  Created by IntelliJ IDEA.
  User: tugou
  Date: 2017/5/3
  Time: 15:53
  To change this template use File | Settings | File Templates.
--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page pageEncoding="UTF-8" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"
          name="viewport" id="viewport">
    <title>添加新练车点</title>
    <script src="<%=basePath%>js/jquery.min.js"></script>
    <script src="<%=basePath%>layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/main.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>layui/css/layui.css" media="all">

</head>
<header>
    <h1><a href="./index.html">报名学车管理后台</a></h1>
</header>
<div id="user_nav">
    <a href="<%=basePath%>sys/changePaw"><h1>${sysuser.userName}</h1></a>
    <h2>
        <c:if test="${sysuser.userType == 1}">
            系统管理员
        </c:if>
        <c:if test="${sysuser.userType == 2}">
            运营人员
        </c:if>
    </h2>
    <a href="<%=basePath%>admin/loginOut"><h3>退出</h3></a>
</div>
<div id="sidebar">
    <ul>
        <%--  <li><a href="index.html"><i class="icon icon_home"></i><span>首页</span></a></li>--%>
            <li><a href="<%=basePath%>sys/index/1"><i class="icon icon_home"></i><span>首页</span></a></li>
            <li><a href="<%=basePath%>sys/userList"><i class="icon icon_users"></i><span>人员管理</span></a></li>
        <li><a href="<%=basePath%>sys/getStudentList"><i class="icon icon_chapter"></i><span>学员信息管理</span></a></li>
        <li class="active"><a href="#"><i
                class="icon icon_exams"></i><span>学车点管理</span></a></li>
            <li><a href="<%=basePath%>sys/settingPage"><i class="icon icon_setting"></i><span>网站设置</span></a></li>
    </ul>
</div>
<form class="layui-form" action="#">
    <div id="content">
        <div class="title_h1">
            <h1>学车地点管理</h1>
        </div>
        <div class="setting">
            <div id="datelist">
                <div class="datelist_title">
                    <div class="icon_align_justify"></div>
                    <h1>地点列表</h1>
                    <div class="icon_exams_add"><a href="<%=basePath%>sys/addExamsPage" target="_self">添加地点</a></div>
                </div>
                <table class="datetable">
                    <thead>
                    <tr>
                        <th>所在区域</th>
                        <th>学车点</th>
                        <th>联系电话</th>
                        <th>地点经度</th>
                        <th>地点纬度</th>
                        <th>创建时间</th>
                        <th>修改</th>
                        <th>关闭</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="loc" items="${locationList}">
                        <tr>
                            <td>${loc.areaname}</td>
                            <td>${loc.locationname}</td>
                            <td>${loc.dsphone}</td>
                            <td>${loc.locationX}</td>
                            <td>${loc.locationY}</td>
                            <td>${loc.createDate}</td>
                            <td>
                                <div class="btn_group">
                                    <a href="<%=basePath%>sys/addExamsPage?id=${loc.id}" title="修改地点">
                                        <em class="icon_edit"></em>
                                    </a>
                                </div>
                            </td>
                            <td>
                                <div class="btn_group layui-input-block">
                                    <c:if test="${loc.state == 1}">
                                        <input type="checkbox" name="state" checked="checked" lay-skin="switch"
                                               lay-filter="switchTest" lay-text="ON|OFF" id="${loc.id}">
                                    </c:if>
                                    <c:if test="${loc.state == 0}">
                                        <input type="checkbox" name="state" lay-skin="switch" lay-filter="switchTest"
                                               lay-text="ON|OFF" id="${loc.id}">
                                    </c:if>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <!--<div class="datatables_toolbar">
                    <div class="datatables_paginat"><a href="#">首页</a><a href="#">上一页</a><a class="active" href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">下一页</a><a href="#">尾页</a></div>
                </div>-->
            </div>
        </div>
        <footer>© 2017 All Rights Reserved</footer>
    </div>
</form>
<script src="<%=basePath%>layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form'], function () {
        var form = layui.form();
        //监听指定开关
        form.on('switch(switchTest)', function (data) {
            var obj = new Object();
            obj.id = this.id;
            $.post("<%=basePath%>sys/deleteExams", obj, function (returnData) {
                if (returnData.code == "00000") {

                }
                else {
                    this.checked = false;
                    layer.msg(returnData.msg);
                }
            });
            layer.msg((this.checked ? '开启' : '关闭'), {
                offset: '6px'
            });
            //layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });
    });
</script>
</body>
</html>
